import java.io.*;
import java.net.*;
import java.util.Scanner;

public class Client {
  public static void main(String[] args) throws IOException {
    Scanner uin = new Scanner(System.in);
    System.out.print("Please enter in an integer:\t");
    int num = uin.nextInt();
    uin.close();

    Socket client = new Socket("127.0.0.1", 9999);

    DataInputStream is = new DataInputStream(client.getInputStream());
    DataOutputStream os = new DataOutputStream(client.getOutputStream());

    os.writeInt(num);

    double response = is.readDouble();

    os.close();
    is.close();

    client.close();

    System.out.println("Sent " + num + " and received " +
      response + ".");
  }
}
